# -*- coding:utf-8 -*-

# date： 2020-5-11
# author： jingluo

import re
# 1. search
pat = re.compile("AA") # 生成或创建正则表达式对象
pat.search("ABCAA")

# 2. search
re.search("AA", "ABCAA")

# 3.findall
re.findall("[A-Z]", "ASDaDFGAa")
# ["A", "S", "D", "D", "F", "G", "A"]

# 4.findall
re.findall("[A-Z]+", "ASDaDFGAa")
# ["ASD", "DFGA"]

# 5. sub
re.sub("a", "A", "abcdef")

# 6. 添加r，免去转义字符的问题
a = r"\aabd-\'"